namespace Crux.Core.MongoDb;
/// <summary>
/// MongoDBContext
/// </summary>
public class MongoDBContext(IMongoDatabase database) : IMongoDBContext
{
    #region implements IMongoDBContext
    /// <inheritdoc/>
    public IMongoDatabase Database => database;
    /// <inheritdoc/>
    public IMongoCollection<K> DbSet<K, TPrimary>() where K : IGenericEntity<TPrimary>
    {
        return database.GetCollection<K>(typeof(K).Name);
    }
    /// <inheritdoc/>
    public IMongoCollection<K> DbSet<K, TPrimary>(string name) where K : IGenericEntity<TPrimary>
    {
        return database.GetCollection<K>(name);
    }
    #endregion implements IMongoDBContext
}